package com.vmove.childtrain.db.data;

import android.content.Context;

import com.j256.ormlite.dao.Dao;
import com.vmove.childtrain.db.entity.Light;
import com.vmove.childtrain.db.entity.Program;
import com.vmove.childtrain.db.entity.Team;
import com.vmove.childtrain.db.entity.User;
import com.vmove.childtrain.protocol.LightCMD;
import com.vmove.childtrain.utils.TimeUtils;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 初始化数据
 */
public class InitData {
    public List<Light> initLight() {
        List<Light> lights = new ArrayList<>();
        for (int i=1;i<=16;i++){
            Light light = new Light();
            light.setCreateTime(TimeUtils.convertToTime(TimeUtils.FORMAT_TIME_EN, new Date()));
            light.setLightId(i);
            light.setSn("");
            lights.add(light);
        }
        return lights;
    }

    /**
     * 课程1配置 红色 永不超时 触发模式：both
     * @return
     */
    public Program getLessonProgram1(){
        Program program = new Program();
        program.setId(1);
        program.setChufamode(LightCMD.CheckMode.ALL.getByte());
        program.setColor(LightCMD.Color.RED.getByte());
        return program;
    }

    /**
     * 课程2配置 固定四色 永不超时 触发模式：pat
     * @return
     */
    public Program getLessonProgram2(){
        Program program = new Program();
        program.setId(2);
        program.setChufamode(LightCMD.CheckMode.PAT.getByte());
        return program;
    }

    /**
     * 课程3配置 永不超时 触发模式：both
     * @return
     */
    public Program getLessonProgram3(){
        Program program = new Program();
        program.setId(3);
        program.setChufamode(LightCMD.CheckMode.ALL.getByte());
        return program;
    }

    /**
     * 课程3配置 永不超时 触发模式：both
     * @return
     */
    public Program getLessonProgram4(){
        Program program = new Program();
        program.setId(4);
        program.setColor(LightCMD.Color.RED.getByte());
        program.setChufamode(LightCMD.CheckMode.ALL.getByte());
        return program;
    }

    public List<Team> getTestTeam(){
        List<Team> teams = new ArrayList<>();
        Team team1 = new Team();
        team1.setTeamname("小班");
        Team team2 = new Team();
        team2.setTeamname("中班");
        Team team3 = new Team();
        team3.setTeamname("大班");
        teams.add(team1);
        teams.add(team2);
        teams.add(team3);
        return teams;
    }

    public List<User> getTestUsers(){
        List<User> users = new ArrayList<>();
        for (int i=0;i<5;i++){
            User user = new User();
            user.setUsername("牛牛");
            user.setSex(0);
            user.setBirthYear(2011);
            user.setBirthMonth(5);
            user.setHeight(120);
            user.setWeight(40);
            user.setTeam(new Team(1));
            User user1 = new User();
            user1.setUsername("果果");
            user1.setSex(1);
            user1.setBirthYear(2011);
            user1.setBirthMonth(10);
            user1.setHeight(110);
            user1.setWeight(40);
            user1.setTeam(new Team(2));
            User user2 = new User();
            user2.setUsername("壮壮");
            user2.setSex(0);
            user2.setBirthYear(2011);
            user2.setBirthMonth(11);
            user2.setHeight(130);
            user2.setWeight(50);
            user2.setTeam(new Team(3));
            users.add(user);
            users.add(user1);
            users.add(user2);
        }
        return users;
    }

}
